// Copyright (c) 2022 Presto Labs Pte. Ltd.
// Author: fengyang

#pragma once

#include <string>

// proto
#include "coin/feed/fastfeed/feed.pb.h"
#include "coin2/exchange/di/constant.h"
#include "coin2/app/driver.h"

namespace coin2::exchange::base::feed::rest {

using fastfeed::proto::Feed;
using fastfeed::proto::KlineInterval;
using fastfeed::proto::TradingDataInterval;
using coin2::exchange::di::ConstantInjection;
using coin2::app::DriverConfig;

class MarketDataClient {
 public:
  MarketDataClient();
  Feed QueryKlines(
      const std::string& mea,
      const std::string& norm,
      KlineInterval interval,
      int64_t start,
      int64_t end) const;
  Feed QueryTopLongShortAccountRatio(
      const std::string& mea,
      const std::string& norm,
      TradingDataInterval interval,
      int64_t start,
      int64_t end) const;
  Feed QueryTopLongShortPositionRatio(
      const std::string& mea,
      const std::string& norm,
      TradingDataInterval interval,
      int64_t start,
      int64_t end) const;
  Feed QueryGlobalLongShortAccountRatio(
      const std::string& mea,
      const std::string& norm,
      TradingDataInterval interval,
      int64_t start,
      int64_t end) const;
  Feed QueryTakerBuySellRatio(
      const std::string& mea,
      const std::string& norm,
      TradingDataInterval interval,
      int64_t start,
      int64_t end) const;
  Feed QueryOpenInterestHist(
      const std::string& mea,
      const std::string& norm,
      TradingDataInterval interval,
      int64_t start,
      int64_t end) const;
 private:
  Feed QueryTradingData(
      const std::string& mea,
      const std::string& norm,
      TradingDataInterval interval,
      int64_t start,
      int64_t end,
      const std::string& channel) const;
  ConstantInjection ci_;
  bool rate_config_enable_ = false;
  DriverConfig rate_config_;
};

}  // namespace coin2::exchange::base::feed::rest
